package com.yoga.manager.beanUtil;

import com.yoga.common.bo.ClassTableBO;
import com.yoga.dao.domain.ClassTableDO;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * 类ClassTableBeanUtil.java的实现描述：团课课程表工具类
 * 
 * @Author hdx
 * @Date 2020年09月24日
 */
public class ClassTableBeanUtil {

    private ClassTableBeanUtil(){
    }

    public static ClassTableDO classTableBOToDO(ClassTableBO srcObj) {
        if (srcObj == null) {
            return null;
        }
        ClassTableDO targetObj = new ClassTableDO();
        targetObj.setId(srcObj.getClassTableId());//id
        targetObj.setCourseId(srcObj.getCourseId());//课程id
        targetObj.setClassType(srcObj.getClassType());//课程类型：1、团课，2、私教课
        targetObj.setTeacherName(srcObj.getTeacherName());//上课老师
        targetObj.setStartTime(srcObj.getStartTime());//上课开始时间
        targetObj.setEndTime(srcObj.getEndTime());//上课结束时间
        targetObj.setAboutNumber(srcObj.getAboutNumber());//当前约课人数
        targetObj.setMaxAboutNumber(srcObj.getMaxAboutNumber());//上限约课人数
        targetObj.setClassDate(srcObj.getClassDate());//上课日期，年月日
        targetObj.setDeleteMark(srcObj.getDeleteMark());//0、正常，1、已删除
        targetObj.setCreateTime(srcObj.getCreateTime());
        targetObj.setUpdateTime(srcObj.getUpdateTime());
        targetObj.setYogaShopId(srcObj.getYogaShopId());
        targetObj.setTeacherImg(srcObj.getTeacherImg());

        targetObj.setCourseName(srcObj.getCourseName());
        targetObj.setCourseLevel(srcObj.getCourseLevel());

        return targetObj;
    }

    public static ClassTableBO classTableDOToBO(ClassTableDO srcObj) {
        if (srcObj == null) {
            return null;
        }
        ClassTableBO targetObj = new ClassTableBO();
        targetObj.setClassTableId(srcObj.getId());//id
        targetObj.setCourseId(srcObj.getCourseId());//课程id
        targetObj.setClassType(srcObj.getClassType());//课程类型：1、团课，2、私教课
        targetObj.setTeacherName(srcObj.getTeacherName());//上课老师
        targetObj.setStartTime(srcObj.getStartTime());//上课开始时间
        targetObj.setEndTime(srcObj.getEndTime());//上课结束时间
        targetObj.setAboutNumber(srcObj.getAboutNumber());//当前约课人数
        targetObj.setMaxAboutNumber(srcObj.getMaxAboutNumber());//上限约课人数
        targetObj.setClassDate(srcObj.getClassDate());//上课日期，年月日
        targetObj.setDeleteMark(srcObj.getDeleteMark());//0、正常，1、已删除
        targetObj.setCreateTime(srcObj.getCreateTime());
        targetObj.setUpdateTime(srcObj.getUpdateTime());
        targetObj.setYogaShopId(srcObj.getYogaShopId());
        targetObj.setTeacherImg(srcObj.getTeacherImg());

        targetObj.setCourseName(srcObj.getCourseName());
        targetObj.setCourseLevel(srcObj.getCourseLevel());

        return targetObj;
    }

    public static List<ClassTableBO> doList2BOList(List<ClassTableDO> doList) {
        List<ClassTableBO> boList = new ArrayList<>();
        if (CollectionUtils.isEmpty(doList)) {
            return boList;
        }
        doList.stream().forEach(classTableDO -> boList.add(ClassTableBeanUtil.classTableDOToBO(classTableDO)));
        return boList;
    }
}